package com.example.controller;

import com.example.service.LoginService;
import com.example.utils.R;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class UserController {
    @Resource
    private LoginService userService;

    @GetMapping("/h1")
    @PreAuthorize("hasAnyAuthority('system:test:list','system:dept:list')")
    public R h1() {
        return R.ok("HELLO h1");
    }

    @GetMapping("/h2")
    @PreAuthorize("hasAuthority('system:dept:list')")
    public R h2() {
        return R.ok("HELLO h2");
    }
    @GetMapping("/h3")
    @PreAuthorize("hasRole('admins') and hasAuthority('system:dept:list')")
    public R h3() {
        return R.ok("HELLO h3");
    }

}
